package com.coin900.coin.service.sbi;

import com.coin900.coin.persist.sbi.SbiRateVO;
import com.value.mybatis.IDaoRouter;
import com.value.mybatis.Pagination;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 服务费率
 *
 * @author shui
 * @create 2018-1-27
 */
@Service
public class SbiRateService implements ISbiRateService {

    @Override
    public List<SbiRateVO> loadSbiRate(Map<String, Object> params){
        return this.daoRouter.query("SbiRate.loadSbiRate",params);
    }

    @Override
    public List<SbiRateVO> loadSbiRateForPage(Pagination pagination) {
        return this.daoRouter.query("SbiRate.loadSbiRateForPage",pagination);
    }

    @Override
    public SbiRateVO getSbiRate(Long coinId) {
        Map<String,Object> params = new HashMap<>();
        params.put("dataStatus",1);
        params.put("coinId",coinId);
        return this.daoRouter.queryForObject("SbiRate.loadSbiRate",params);
    }

    @Override
    public void insertSbiRate(SbiRateVO sbiRateVO){
        this.daoRouter.insert("SbiRate.insertSbiRate", sbiRateVO);
    }

    @Override
    public void updateSbiRate(SbiRateVO sbiRateVO){
        this.daoRouter.update("SbiRate.updateSbiRate", sbiRateVO);
    }

    @Override
    public void deleteSbiRate(SbiRateVO sbiRateVO){
        this.daoRouter.update("SbiRate.deleteSbiRate", sbiRateVO);
    }

    @Autowired
    private IDaoRouter daoRouter;

}